package com.common;

import java.io.BufferedInputStream;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.Map;
import java.util.Properties;

public class Cache {

    /**
     * 数据库连接信息配置文件路径
     */
    private static String path = Cache.class.getClassLoader().getResource("/jdbc.properties").getPath();;

    public static String driver;

    public static String url;

    public static String username;

    public static String password;

    public Map<String, Object> map;

    static {
        InputStream in = null;
        Properties prop = null;
        try {
            // in = Cache.class.getClassLoader().getResourceAsStream("/jdbc.properties");
            in = new BufferedInputStream(new FileInputStream(path));
            prop = new Properties();
            prop.load(in);
            driver = prop.getProperty("driver");
            url = prop.getProperty("url");
            username = prop.getProperty("username");
            password = prop.getProperty("password");
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            try {
                in.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }

}
